/*
 * @Author: cl
 * @Description:
 * @Date: 2023-04-07 10:23:48
 * @LastEditTime: 2023-04-13 09:44:10
 * @FilePath: \jsnode\nestjs\naota\src\tiger\entities\tiger.entity.ts
 * @LastEditors: cl
 */
import { Column, CreateDateColumn, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm'
import { Son } from './son.entity'

@Entity()
export class Tiger {
  @PrimaryGeneratedColumn({ type: 'int' })
  id: number

  @Column({ type: 'varchar', length: 200 })
  name: string

  @Column({ type: 'int', nullable: true })
  age?: number

  @CreateDateColumn({ type: 'timestamp', nullable: true })
  create_time?: Date

  @Column({
    type: 'enum',
    enum: ['男', '女', '未知'],
    default: '未知',
    nullable: true,
  })
  sex?: string

  @OneToMany(() => Son, (sons) => sons.tiger)
  sons: Son[]
}
